package com.hundredapp.oa.web.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import com.hundredapp.oa.dao.SelectType;
import com.hundredapp.oa.domain.OaAction;
import com.hundredapp.oa.repository.ActionManager;
import com.hundredapp.oa.repository.RoleManager;
import com.opensymphony.xwork2.ActionSupport;


@Repository
@Scope("prototype")
public class Action1 extends ActionSupport {
	@Autowired
	private ActionManager actionManager;
	@Autowired
	private RoleManager roleManage;
	private List<OaAction> root;
	private int roleid;
	
	public String allaction() {
		root = actionManager.findAllLeaf(SelectType.SELECT_ALL);
		return SUCCESS;
	}
	
	public String roleactions() {
		root = roleManage.findById(roleid).getOaActions();
		return SUCCESS;
	}

	public List<OaAction> getRoot() {
		return root;
	}

	public void setRoleManage(RoleManager roleManage) {
		this.roleManage = roleManage;
	}

	public void setRoleid(int roleid) {
		this.roleid = roleid;
	}
	
	
}
